home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0012_GoToXY Replacment.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  3KB  |  79 lines

  1. {BRIAN DHATT
  2.  
  3. > Does anyone have codes/source For replacing GotoXY Procedure?
  4. }
  5. Asm
  6.   MOV AH,$0F                   {To get active page, returns BH}
  7.   INT $10
  8.   MOV Page,BH
  9. end;
  10.  
  11. Asm                  {to find current cursor pos in form XX,YY}
  12.   MOV AH,$3           {Equiv of XX:=WhereX, YY:=WhereY         }
  13.   MOV BH,Page
  14.   INT $10
  15.   MOV YY,DH
  16.   MOV XX,DL
  17. end;
  18.  
  19. Asm                        {This block moves the cursor to           }
  20.   MOV AH,$02               {XX,YY just like GotoXY(XX,YY)            }
  21.   MOV BH,Page
  22.   MOV DL,XX
  23.   MOV DH,YY
  24.   INT $10
  25. end;
  26.  
  27. {
  28. GREG ESTABROOKS
  29.  
  30. >Can someone tell me how to make the cursor in Turbo Pascal disappear and
  31. >appear?
  32. }
  33.  
  34. Program CursorDemo;              (*  May 27/93, Greg Estabrooks     *)
  35. Uses
  36.   Crt;                        (*  For ReadKey, ClrScr.           *)
  37. Const
  38.   (* Define Cursor Value to make chaning cursor easier *)
  39.   NoCursor      = $2000;
  40.   DefaultCursor = $0607;
  41.   BlockCursor   = $000A;
  42. Var
  43.   Curs : Word;                 (* Stores saved cursor value         *)
  44.   Ch   : Char;
  45.  
  46. Procedure SetCursor(Cursor : Word); Assembler;
  47.                     (* Routine to change the shape of the cursor    *)
  48. Asm
  49.   Mov AH,1                      (* Function to change cursor shape   *)
  50.   Mov BH,0                      (* Set Page to 0                     *)
  51.   Mov CX,Cursor                 (* Load new cursor Shape Value       *)
  52.   Int $10                       (* Call Dos                          *)
  53. end;{SetCursor}
  54.  
  55. Function GetCursor : Word; Assembler;
  56.                    (* Routine to return Cursor Shape                 *)
  57. Asm
  58.   Mov AH,3                      (* Function to return cursor shape   *)
  59.   Mov BH,0                      (* Set Page to 0                     *)
  60.   Int $10                       (* Call Dos                          *)
  61.   Mov AX,CX                     (* Move Result to proper register    *)
  62. end;{GetCursor}
  63.  
  64. begin
  65.   ClrScr;                       (* Clear the screen For demonstration*)
  66.   Curs := GetCursor;            (* Save Current Cursor Value         *)
  67.   Writeln('The Cursor is turned off');
  68.   SetCursor( NoCursor );        (* Turn off the cursor               *)
  69.   Ch := ReadKey;                (* Pause to show user new cursor     *)
  70.   Writeln('The Cursor is a block shape');
  71.   SetCursor( BlockCursor );     (*  Set the cursor to a block        *)
  72.   Ch := ReadKey;
  73.   Writeln('The Cursor is now the normal shape');
  74.   SetCursor( DefaultCursor );   (* Set Default Cursor                *)
  75.   Ch := ReadKey;
  76.  
  77.   SetCursor( Curs );            (* Restore cursor to previous style  *)
  78. end.
  79.